Crate hermit_abi
source ·Expand description
hermit-abi
is small interface to call functions from the
Hermit unikernel.
Re-exports§
pub use self::errno::*;
Modules§
Structs§
- Priority of a thread
- Describes a region of memory, beginning at
iov_base
address and with the size ofiov_len
bytes. timespec
is used byclock_gettime
to retrieve the current time
Enums§
- Equivalent to C’s
void
type when used as a pointer.
Constants§
- Maximum number of priorities
- The largest number
rand
will return
Functions§
- cause abnormal termination
- Returns an estimate of the default amount of parallelism a program should use. This number often corresponds to the amount of CPUs a computer has, but it may diverge in various cases.
- bind⚠bind a name to a socket
- Add current task to the queue of blocked tasks. After calling
block_current_task
, callyield_now
to switch to another task. - Add current task to the queue of blocked tasks, but wake it when
timeout
milliseconds have elapsed. - get current time
- close a file descriptor
- dup⚠duplicate an existing file descriptor
- Get the last error number from the thread local storage
eventfd
creates an linux-like “eventfd object” that can be used as an event wait/notify mechanism by user-space applications, and by the kernel to notify user-space applications of events. The object contains an unsigned 64-bit integer counter that is maintained by the kernel. This counter is initialized with the value specified in the argumentinitval
.- exit⚠cause normal termination and return
status
to the host system - free⚠
- fstat
- If the value at address matches the expected value, park the current thread until it is either woken up with
futex_wake
(returns 0) or an optional timeout elapses (returns -ETIMEDOUT). - Wake
count
threads waiting on the futex ataddress
. Returns the number of threads woken up (saturates toi32::MAX
). Ifcount
isi32::MAX
, wake up all matching waiting threads. Ifcount
is negative oraddress
is null, returns -EINVAL. - Get the last error number from the thread local storage
- Determine the priority of the current thread
- get_processor_count⚠Deprecateddetermines the number of activated processors
- The system call
getaddrbyname
determine the network host entry. It expects an array of u8 with a size of in_addr or of in6_addr. The result of the DNS request will be stored in this array. getdents64
reads directory entries from the directory referenced by the file descriptorfd
into the buffer pointed to bybuf
.- Determines the id of the current thread
- returns true if file descriptor
fd
is a tty - join⚠join with a terminated thread
- listen for connections on a socket
- lstat
- ‘mkdir’ attempts to create a directory, it returns 0 on success and -1 on error
- suspend thread execution for an interval measured in nanoseconds
- initialize the network stack
- open⚠open and possibly create a file
- opendir⚠Deprecatedopen a directory
- poll⚠The unix-like
poll
waits for one of a set of file descriptors to become ready to perform I/O. The set of file descriptors to be monitored is specified in thefds
argument, which is an array of structures ofpollfd
. - read⚠read from a file descriptor
- Fill
len
bytes inbuf
with cryptographically secure random data. read()
attempts to readnbyte
of data to the object referenced by the descriptorfd
from a buffer.read()
performs the same action, but scatters the input data from theiovcnt
buffers specified by the members of the iov array:iov[0], iov[1], ..., iov[iovcnt-1]
.- recv⚠receive() a message from a socket
- receive() a message from a socket
- remove directory it refers to
name
- sem_destroy() frees the unnamed semaphore at the address pointed to by
sem
. - sem_init() initializes the unnamed semaphore at the address pointed to by
sem
. Thevalue
argument specifies the initial value for the semaphore. Ifpshared
is nonzero, then the semaphore is shared between processes (currently not supported). - sem_post() increments the semaphore pointed to by
sem
. If the semaphore’s value consequently becomes greater than zero, then another thread blocked in a sem_wait call will be woken up and proceed to lock the semaphore. - decrement a semaphore
- try to decrement a semaphore
- send⚠
- Determine the priority of the current thread
- shut down part of a full-duplex connection
- shutdown_socket⚠Deprecated
- spawn a new thread
- spawn a new thread with user-specified stack size
- stat⚠stat
- delete the file it refers to
name
- suspend execution for microsecond intervals
- Wakeup task with the thread id
tid
- write to a file descriptor
write()
attempts to writenbyte
of data to the object referenced by the descriptorfd
from a buffer.writev()
performs the same action, but gathers the output data from theiovcnt
buffers specified by the members of the iov array:iov[0], iov[1], ..., iov[iovcnt-1]
.- yield the processor
Type Aliases§
- A thread handle type
- Equivalent to C’s
signed int
(int
) type. - Equivalent to C’s
signed short
(short
) type.